package com.monkey.core.domain.icon;

import com.monkey.core.domain.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Project  : monkey
 * Author   : Wu Tian Qiang
 * Date     : 2016/9/12
 */
@Entity
@Table(name = "sys_icon")
@DynamicUpdate
@DynamicInsert
public class Icon extends BaseEntity<Long> {
    private String name;

    @Column(name = "icon_type")
    @Enumerated(EnumType.STRING)
    private IconType iconType;

    public Icon() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public IconType getIconType() {
        return iconType;
    }

    public void setIconType(IconType iconType) {
        this.iconType = iconType;
    }

    @Transient
    public String getIcon() {
        return iconType.getLabel() + "/" + name;
    }

    @Transient
    public int getHeight() {
        return iconType.getIconHeight();
    }
}
